package com.mccrea.pattern.builder;

/**
 * @Classname HouseDirector
 * @Description 指挥者，动态的指挥动态流程，返回具体产品
 * @Date 2021/5/8 0008 13:47
 * @Created by Mccrea_Gao
 */
public class HouseDirector {
    HouseBuilder houseBuilder;

    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public House build() {
        houseBuilder.buildBasis();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
